
#include "Mapper034.h"
#include "BNROM.h"
#include "NES.h"
#include "NINA-001.h"
#include "Cart.h"

SETUP_STATIC_INES_MAPPER_REGISTRAR(34)

//------------------------------------------------------------------------------
// Name:
//------------------------------------------------------------------------------
Mapper34::Mapper34() {

	// for now, this is how we tell the difference, iNES2.0 sub mappers
	// or UNIF would be preferable
	if(nes::cart.has_chr_rom()) {
		mapper_ = new NINA_001;
	} else {
		mapper_ = new BNROM;
	}
}

//------------------------------------------------------------------------------
// Name:
//------------------------------------------------------------------------------
Mapper34::~Mapper34() {
	delete mapper_;
}

//------------------------------------------------------------------------------
// Name:
//------------------------------------------------------------------------------
std::string Mapper34::name() const {
	return mapper_->name();
}

//------------------------------------------------------------------------------
// Name:
//------------------------------------------------------------------------------
void Mapper34::write_7(uint16_t address, uint8_t value) {
	mapper_->write_7(address, value);
}

//------------------------------------------------------------------------------
// Name:
//------------------------------------------------------------------------------
void Mapper34::write_8(uint16_t address, uint8_t value) {
	mapper_->write_8(address, value);
}

//------------------------------------------------------------------------------
// Name:
//------------------------------------------------------------------------------
void Mapper34::write_9(uint16_t address, uint8_t value) {
	mapper_->write_9(address, value);
}

//------------------------------------------------------------------------------
// Name:
//------------------------------------------------------------------------------
void Mapper34::write_a(uint16_t address, uint8_t value) {
	mapper_->write_a(address, value);
}

//------------------------------------------------------------------------------
// Name:
//------------------------------------------------------------------------------
void Mapper34::write_b(uint16_t address, uint8_t value) {
	mapper_->write_b(address, value);
}

//------------------------------------------------------------------------------
// Name:
//------------------------------------------------------------------------------
void Mapper34::write_c(uint16_t address, uint8_t value) {
	mapper_->write_c(address, value);
}

//------------------------------------------------------------------------------
// Name:
//------------------------------------------------------------------------------
void Mapper34::write_d(uint16_t address, uint8_t value) {
	mapper_->write_d(address, value);
}

//------------------------------------------------------------------------------
// Name:
//------------------------------------------------------------------------------
void Mapper34::write_e(uint16_t address, uint8_t value) {
	mapper_->write_e(address, value);
}

//------------------------------------------------------------------------------
// Name:
//------------------------------------------------------------------------------
void Mapper34::write_f(uint16_t address, uint8_t value) {
	mapper_->write_f(address, value);
}
